package com.yhstudio.designPattern.adapter;

public class MediaSiteAdapter extends OldMediaSite implements INewMediaSite {

    private String type;

    public MediaSiteAdapter(String type) {
        this.type = type;
    }

    @Override
    public void playMp4() {
        System.out.println("播放 mp4");
    }

    @Override
    public void playM4a() {
        System.out.println("播放 m4a");
    }

    public void play() {
        switch (type) {
            case "mp3":
                playMp3();
                break;
            case "mp4":
                playMp4();
                break;
            case "m4a":
                playM4a();
                break;
            default:
                System.out.println("对不起格式不支持.");
                break;
        }
    }
}
